using System;
using UnityEngine;

namespace Voodoo.Sauce.Internal.Analytics
{
	[Serializable]
	public class DebugForcedCohort
	{
		public int index;

		private VoodooSettings settings;

		public DebugForcedCohort()
		{
			index = 0;
		}

		public string GetCohort()
		{
			if (settings == null)
			{
				settings = Resources.Load<VoodooSettings>("VoodooSettings");
			}
			string[] runningABTests = settings.RunningABTests;
			if (index >= 3)
			{
				return runningABTests[index - 3];
			}
			return "Control";
		}

		public bool HasForcedNoCohort()
		{
			return index == 1;
		}

		private bool IsNotEmpty()
		{
			return index > 0;
		}

		public bool IsDebugCohort()
		{
			return (Debug.isDebugBuild || Application.isEditor) && IsNotEmpty();
		}
	}
}
